# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2011, Blender Foundation
# All rights reserved.
#
# Contributor(s): Blender Foundation,
#                 Sergey Sharybin
#
# ***** END GPL LICENSE BLOCK *****

# NOTE: This file is automatically generated by bundle.sh script
#       If you're doing changes in this file, please update template
#       in that script too

set(INC
	.
)

set(INC_SYS
)

set(SRC
	libmv-capi.h
)

if(WITH_LIBMV)
	add_definitions(${GFLAGS_DEFINES})
	add_definitions(${GLOG_DEFINES})
	add_definitions(${CERES_DEFINES})
	add_definitions(-DLIBMV_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})

	list(APPEND INC
		${GFLAGS_INCLUDE_DIRS}
		../../extern/glog/src
		../../extern/ceres/include
		../../extern/ceres/config
		../guardedalloc
	)

	list(APPEND INC_SYS
		${EIGEN3_INCLUDE_DIRS}
		${PNG_INCLUDE_DIRS}
		${ZLIB_INCLUDE_DIRS}
	)

	add_definitions(
		-DWITH_LIBMV_GUARDED_ALLOC
		-DLIBMV_NO_FAST_DETECTOR=
	)

	list(APPEND SRC
		intern/autotrack.cc
		intern/camera_intrinsics.cc
		intern/detector.cc
		intern/frame_accessor.cc
		intern/homography.cc
		intern/image.cc
		intern/logging.cc
		intern/reconstruction.cc
		intern/track_region.cc
		intern/tracks.cc
		intern/tracksN.cc
		libmv/autotrack/autotrack.cc
		libmv/autotrack/predict_tracks.cc
		libmv/autotrack/tracks.cc
		libmv/base/aligned_malloc.cc
		libmv/image/array_nd.cc
		libmv/image/convolve.cc
		libmv/multiview/conditioning.cc
		libmv/multiview/euclidean_resection.cc
		libmv/multiview/fundamental.cc
		libmv/multiview/homography.cc
		libmv/multiview/panography.cc
		libmv/multiview/panography_kernel.cc
		libmv/multiview/projection.cc
		libmv/multiview/triangulation.cc
		libmv/numeric/numeric.cc
		libmv/numeric/poly.cc
		libmv/simple_pipeline/bundle.cc
		libmv/simple_pipeline/camera_intrinsics.cc
		libmv/simple_pipeline/detect.cc
		libmv/simple_pipeline/distortion_models.cc
		libmv/simple_pipeline/initialize_reconstruction.cc
		libmv/simple_pipeline/intersect.cc
		libmv/simple_pipeline/keyframe_selection.cc
		libmv/simple_pipeline/modal_solver.cc
		libmv/simple_pipeline/pipeline.cc
		libmv/simple_pipeline/reconstruction.cc
		libmv/simple_pipeline/reconstruction_scale.cc
		libmv/simple_pipeline/resect.cc
		libmv/simple_pipeline/tracks.cc
		libmv/tracking/brute_region_tracker.cc
		libmv/tracking/hybrid_region_tracker.cc
		libmv/tracking/klt_region_tracker.cc
		libmv/tracking/pyramid_region_tracker.cc
		libmv/tracking/retrack_region_tracker.cc
		libmv/tracking/track_region.cc
		libmv/tracking/trklt_region_tracker.cc


		intern/autotrack.h
		intern/camera_intrinsics.h
		intern/detector.h
		intern/frame_accessor.h
		intern/homography.h
		intern/image.h
		intern/logging.h
		intern/reconstruction.h
		intern/track_region.h
		intern/tracks.h
		intern/tracksN.h
		libmv/autotrack/autotrack.h
		libmv/autotrack/callbacks.h
		libmv/autotrack/frame_accessor.h
		libmv/autotrack/marker.h
		libmv/autotrack/model.h
		libmv/autotrack/predict_tracks.h
		libmv/autotrack/quad.h
		libmv/autotrack/reconstruction.h
		libmv/autotrack/region.h
		libmv/autotrack/tracks.h
		libmv/base/aligned_malloc.h
		libmv/base/id_generator.h
		libmv/base/scoped_ptr.h
		libmv/base/vector.h
		libmv/base/vector_utils.h
		libmv/image/array_nd.h
		libmv/image/convolve.h
		libmv/image/correlation.h
		libmv/image/image_converter.h
		libmv/image/image_drawing.h
		libmv/image/image.h
		libmv/image/sample.h
		libmv/image/tuple.h
		libmv/logging/logging.h
		libmv/multiview/conditioning.h
		libmv/multiview/euclidean_resection.h
		libmv/multiview/fundamental.h
		libmv/multiview/homography_error.h
		libmv/multiview/homography.h
		libmv/multiview/homography_parameterization.h
		libmv/multiview/nviewtriangulation.h
		libmv/multiview/panography.h
		libmv/multiview/panography_kernel.h
		libmv/multiview/projection.h
		libmv/multiview/resection.h
		libmv/multiview/triangulation.h
		libmv/multiview/two_view_kernel.h
		libmv/numeric/dogleg.h
		libmv/numeric/function_derivative.h
		libmv/numeric/levenberg_marquardt.h
		libmv/numeric/numeric.h
		libmv/numeric/poly.h
		libmv/simple_pipeline/bundle.h
		libmv/simple_pipeline/callbacks.h
		libmv/simple_pipeline/camera_intrinsics.h
		libmv/simple_pipeline/camera_intrinsics_impl.h
		libmv/simple_pipeline/detect.h
		libmv/simple_pipeline/distortion_models.h
		libmv/simple_pipeline/initialize_reconstruction.h
		libmv/simple_pipeline/intersect.h
		libmv/simple_pipeline/keyframe_selection.h
		libmv/simple_pipeline/modal_solver.h
		libmv/simple_pipeline/pipeline.h
		libmv/simple_pipeline/reconstruction.h
		libmv/simple_pipeline/reconstruction_scale.h
		libmv/simple_pipeline/resect.h
		libmv/simple_pipeline/tracks.h
		libmv/tracking/brute_region_tracker.h
		libmv/tracking/hybrid_region_tracker.h
		libmv/tracking/kalman_filter.h
		libmv/tracking/klt_region_tracker.h
		libmv/tracking/pyramid_region_tracker.h
		libmv/tracking/region_tracker.h
		libmv/tracking/retrack_region_tracker.h
		libmv/tracking/track_region.h
		libmv/tracking/trklt_region_tracker.h

		third_party/msinttypes/inttypes.h
		third_party/msinttypes/stdint.h
	)


	if(WITH_GTESTS)
		blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "" "")

		BLENDER_SRC_GTEST("libmv_predict_tracks" "./libmv/autotrack/predict_tracks_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_tracks" "./libmv/autotrack/tracks_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_scoped_ptr" "./libmv/base/scoped_ptr_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_vector" "./libmv/base/vector_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_array_nd" "./libmv/image/array_nd_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_convolve" "./libmv/image/convolve_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_image" "./libmv/image/image_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_sample" "./libmv/image/sample_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_tuple" "./libmv/image/tuple_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_euclidean_resection" "./libmv/multiview/euclidean_resection_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_fundamental" "./libmv/multiview/fundamental_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_homography" "./libmv/multiview/homography_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_nviewtriangulation" "./libmv/multiview/nviewtriangulation_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_panography" "./libmv/multiview/panography_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_projection" "./libmv/multiview/projection_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_resection" "./libmv/multiview/resection_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_triangulation" "./libmv/multiview/triangulation_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_dogleg" "./libmv/numeric/dogleg_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_function_derivative" "./libmv/numeric/function_derivative_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_levenberg_marquardt" "./libmv/numeric/levenberg_marquardt_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_numeric" "./libmv/numeric/numeric_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_poly" "./libmv/numeric/poly_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_camera_intrinsics" "./libmv/simple_pipeline/camera_intrinsics_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_detect" "./libmv/simple_pipeline/detect_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_intersect" "./libmv/simple_pipeline/intersect_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_keyframe_selection" "./libmv/simple_pipeline/keyframe_selection_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_modal_solver" "./libmv/simple_pipeline/modal_solver_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_resect" "./libmv/simple_pipeline/resect_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_brute_region_tracker" "./libmv/tracking/brute_region_tracker_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_klt_region_tracker" "./libmv/tracking/klt_region_tracker_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
		BLENDER_SRC_GTEST("libmv_pyramid_region_tracker" "./libmv/tracking/pyramid_region_tracker_test.cc" "libmv_test_dataset;bf_intern_libmv;extern_ceres")
	endif()
else()
	list(APPEND SRC
		intern/stub.cc
	)
endif()

blender_add_lib(bf_intern_libmv "${SRC}" "${INC}" "${INC_SYS}")
